package dbms;

public class DBException extends Exception {

	// TODO error messages
	public static final String[] errorMsg = new String[]
	{ "DataBase not found.", "DataBase already exists.", "DataBase corrupt.", "Table not found.", "Table already exists.", "Table corrupt.", "Column not found.",
		"Column already exists.", "Cell not found.", "Cell wrong input.", "Unknown exception."};

	public static final int DB_NOTFOUND = 0;
	public static final int DB_DUPLICATE = 1;
	public static final int DB_CORRUPT = 2;
	public static final int TBL_NOTFOUND = 3;
	public static final int TBL_DUPLICATE = 4;
	public static final int TBL_CORRUPT = 5;
	public static final int CLM_NOTFOUND = 6;
	public static final int CLM_DUPLICATE = 7;
	public static final int CEL_NOTFOUND = 8;
	public static final int CEL_WRONGINPUT = 9;
	public static final int UNKNOWN = 10;

	//

	private int cause;

	public DBException(int cause) {
		this.cause = cause;
	}

	@Override
	public String getMessage() {
		return errorMsg[cause];
	}

}
